/*
 * @Author: your name
 * @Date: 2021-08-26 10:13:48
 * @LastEditTime: 2021-08-27 14:56:14
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day04\3-函数的使用.js
 */


//第一种
function test1() {
    console.log('test1');
}

function test1() {
    console.log('第二次test1');
}
test1();

//等价于
var a = 10;
var a = 20;
console.log(a);


//第二种
var test2 = function() {
    console.log('test2');
}
var test2 = function() {
    console.log('第二次test2');
}
test2();
//第一个结论，变量可以重复使用，也可以重复定义
//第二个结论，函数提升

console.log(age); //undefined
var age = 20;
console.log(age); //20


console.log(print); //[function print]
print();

function print() {
    console.log('print');
}


console.log(foo); //undefined  这种定义虽然是函数也是普通变量提升
//foo(); //!error
var foo = function() {
    console.log('foo');
}

//例子
console.log(say); //[function say]
say();

function say() {
    console.log('say') //say
}
var say = 'name';
console.log(say); //name
//say();//!error